/// ? 同 try,
use std::fmt;
struct List(Vec<i32>);

impl fmt::Display for List {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let vec = &self.0;
        write!(f, "[")?;
        for (count, v) in vec.iter().enumerate() {
            // 加 ，
            if count != 0 {
                write!(f, ", ")?;
            }
            write!(f, "{count}:{v}")?;
        }
        write!(f, "]")
    }
}

fn main() {
    println!("{}", List(vec![1, 2, 3, 4]));
}
